﻿using LanguagePolish.Base;
using LanguagePolish.EntityModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LanguagePolish.ViewModels
{
    class AddStudentViewModel : BaseViewModel
    {
        public Student Student { get; private set; }

        public string Title { get; private set; }

        public bool HasErrors { get { return Student.HasErrors; } }

        public IEnumerable<Class> Classes
        {
            get { return LinksProvider.Model.EntityContext.Classes.ToList(); }
        }

        public AddStudentViewModel(Student student, bool isEdit = false)
        {
            Student = student;
            InitTitle(isEdit);
        }

        private void InitTitle(bool isEdit)
        {
            Title = isEdit ? "Edit Student" : "Add New Student";
            OnPropertyChanged("Title");
        }
    }
}
